package com.magiccompass.alipay.barcode.entity;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;

import com.magiccompass.alipay.barcode.model.AlipayBarcodeBaseResponse;

@Entity
@Table(name = "TD_ALIPAY_QRCODE_CREATE_RESPONSE")
@DynamicUpdate(value= true)
public class AlipayQRCodeCreateResponse extends AlipayBarcodeBaseResponse {
	@Id
	@Column(name = "ID")
	@GeneratedValue
	private Integer id;
	
	@OneToOne(cascade=CascadeType.MERGE,fetch= FetchType.EAGER)
	@JoinColumn(name="alipay_qrcode_create_request_id",nullable=false ,unique=true)
	private AlipayQRCodeCreateRequest alipayQRCodeCreateRequest;
	
	@Column(name = "is_success",length=1, nullable=false)
	private String isSuccess;
	
	@Column(name = "sign_type",length=10, nullable=false)
	private String signType;
	
	@Column(name = "sign",length=1024, nullable=false)
	private String sign;
	
	@Column(name = "result_code",length=32)
	private String resultCode = "-1";  // -1 means self define result code;
	
	@Column(name = "error",length=48)
	private String error;
	
	@Column(name = "qr_code",length=1000)
	private String qrCode;
	
	@Column(name = "qr_code_img_url",length=2000)
	private String qrCodeImgUrl;
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getIsSuccess() {
		return isSuccess;
	}

	public void setIsSuccess(String isSuccess) {
		this.isSuccess = isSuccess;
	}

	public String getSignType() {
		return signType;
	}

	public void setSignType(String signType) {
		this.signType = signType;
	}

	public String getSign() {
		return sign;
	}

	public void setSign(String sign) {
		this.sign = sign;
	}

	public String getResultCode() {
		return resultCode;
	}

	public void setResultCode(String resultCode) {
		this.resultCode = resultCode;
	}

	public String getError() {
		return error;
	}

	public void setError(String error) {
		this.error = error;
	}

	public AlipayQRCodeCreateRequest getAlipayQRCodeCreateRequest() {
		return alipayQRCodeCreateRequest;
	}

	public void setAlipayQRCodeCreateRequest(AlipayQRCodeCreateRequest alipayQRCodeCreateRequest) {
		this.alipayQRCodeCreateRequest = alipayQRCodeCreateRequest;
	}

	public String getQrCode() {
		return qrCode;
	}

	public void setQrCode(String qrCode) {
		this.qrCode = qrCode;
	}

	public String getQrCodeImgUrl() {
		return qrCodeImgUrl;
	}

	public void setQrCodeImgUrl(String qrCodeImgUrl) {
		this.qrCodeImgUrl = qrCodeImgUrl;
	}
}